package com.lovegu.spring.proxy;

import com.lovegu.spring.ioc.UserDao;
import com.lovegu.spring.ioc.UserDaoMySqlImpl;
import com.lovegu.spring.ioc.UserDaoOracleImpl;
import org.junit.Test;

/**
 * @author 老顾
 * @title: UserServiceImpl
 * @projectName java-restudy
 * @email: 1437594522@qq.com
 * @date 2022/9/25 9:36
 */
public class UserServiceImpl implements UserService{
    private UserDao userDao;
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
    @Override
    public void getUser() {
        userDao.getUser();
    }
    @Test
    public void test(){
        UserServiceImpl service = new UserServiceImpl();
        service.setUserDao( new UserDaoMySqlImpl() );
        service.getUser();
        //那我们现在又想用Oracle去实现呢
        service.setUserDao( new UserDaoOracleImpl() );
        service.getUser();
    }
}
